<?php
/**
 * Created by PhpStorm.
 * User: zw215
 * Date: 2019/3/23
 * Time: 11:26
 */
if (!function_exists('my_test')) {
    function my_test()
    {
        return 'hello world';
    }
}

// 应用公共文件
if (!function_exists('show')) {
    function show($status, $message, $data = array())
    {
        $reuslt = array(
            'responseCode' => $status,
            'responseMessage' => $message,
            'data' => $data,
        );
        $status == 0 ? header("HTTP/1.0 200") : header("HTTP/1.0 500");
        exit(json_encode($reuslt));
    }
}

// 应用公共文件

//生成加密向量
if (!function_exists('getSecretKey')) {
    function getSecretKey()
    {
        return getRandChar(32);
    }
}
//随机数生成
if (!function_exists('getRandChar')) {

    function getRandChar($length)
    {
        $str = null;
        $strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
        $max = strlen($strPol) - 1;
        for ($i = 0; $i < $length; $i++) {
            $str .= $strPol[rand(0, $max)];
        }
        return $str;
    }
}